<?php
//header("Content-Type:application/x-png");//文件类型
//header("Content-Disposition:attachment;filename=\"1.png\"");//文件属性以及文件名
//header ("Expires: 0");//禁用缓存
//header ("Pragma: no-cache"); //禁用缓存
//header("Content-Length:".filesize("1.png"));//文件大小
//$contents=  file_get_contents("1.png");
//echo $contents;
include './include/common.inc.php';
$nowtime=time();
/*
 * 获取公告列表
 */

$q=$db->query("select * from ann where time>{$nowtime} or time=0");
$ann=array();
while($row=$db->fetch_array($q)){
    $ann[]=$row;
}
$tpl->assign("ann",$ann);
/*
 * 获取轮播图片
 */
$q=$db->query("select * from lunbo order by id desc limit 0,4");
$lunbolist=array();
while($row=$db->fetch_array($q)){
    $lunbolist[]=$row;
}
$tpl->assign("lunbolist",$lunbolist);
/*
 * 获取分类
 */
$tpl->assign("types",gettypes());
/*
 * 获取商品列表信息
 */
$tpl->assign("newcommos",getcommo(6));//最新的10条记录
$tpl->assign("hotcommos",getcommo(6,'sell'));//最新的10条记录
$tpl->assign("discount",getdiscount(6));//最新的10条记录
/*
 * 获取用户信息
 */
if($U['uid']){
    $U=$db->fetch_first("select m.* from member m where m.uid={$U['uid']}");
    
    $q=$db->fetch_first("select count(uid) as count from `order` where uid={$U['uid']} and status=0");
    $U['count']=$q['count'];
    unset($q);
    $tpl->assign("U",$U);
}

$tpl->assign("title","首页");
$tpl->display("index.html");